package com.gopay.common.cps.dao.aggregatepayment.impl;

import com.gopay.common.base.dao.impl.BaseReadDAOImpl;
import com.gopay.common.cps.dao.aggregatepayment.ApCustInfoQueryDAO;
import com.gopay.common.domain.aggregatepayment.ApCustInfo;
import org.hibernate.criterion.DetachedCriteria;
import org.hibernate.criterion.Restrictions;
import org.springframework.stereotype.Repository;

import java.util.List;

@Repository("apCustInfoQueryDAO")
public class ApCustInfoQueryDAOImpl extends BaseReadDAOImpl<ApCustInfo,String> implements ApCustInfoQueryDAO {

    @Override
    public List<ApCustInfo> getInfoByCustId(String custId){
        DetachedCriteria detachedCriteria = DetachedCriteria.forClass(ApCustInfo.class);
        detachedCriteria.add(Restrictions.eq("custId", custId));
        return findByCriteria(detachedCriteria);
    }

    @Override
    public List<ApCustInfo> getInfoByAccessChannelAndStatus(String channel, String status){
        DetachedCriteria detachedCriteria = DetachedCriteria.forClass(ApCustInfo.class);
        detachedCriteria.add(Restrictions.eq("interChannel", channel));
        detachedCriteria.add(Restrictions.eq("status", status));
        return findByCriteria(detachedCriteria);
    }

    @Override
    public ApCustInfo getApCustInfoByTraId(String traId) {
        return null;
    }

}
